package com.aotain.oframework.dao.sqlt;

import java.lang.reflect.Method;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.repository.core.NamedQueries;
import org.springframework.data.repository.core.RepositoryMetadata;
import org.springframework.data.repository.query.QueryLookupStrategy;
import org.springframework.data.repository.query.RepositoryQuery;

import com.aotain.oframework.exception.SqlTemplateInitException;
import com.aotain.oframework.exception.SqlTemplateParseException;


//NOT YET COMPLETED.
public class JpaSqltQueryLookupStrategy implements QueryLookupStrategy{
	
	private static final Logger logger = LoggerFactory.getLogger(JpaSqltQueryLookupStrategy.class);

	public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, NamedQueries namedQueries) {
		boolean sqltAnnotated = method.isAnnotationPresent(JpaSqltQuery.class);
		if(sqltAnnotated){
			logger.debug("resolving sqlt query");
		}
		try {
			String l = SqlTemplateEngine.getInstance().getJpql("", "", "");
		} catch (SqlTemplateParseException e) {
			e.printStackTrace();
		} catch (SqlTemplateInitException e) {
			e.printStackTrace();
		}
		return null;
	}
}
